home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes ƒ / Circular wipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.6 KB  |  100 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 2
  4. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6.  
  7. pascal short CircularWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* Trace a region from the center to the topleft corner, over <BlockSize> pixels,
  10.    and back to the center.  Fill that in and move the region parameters +BlockSize.
  11.    Repeat for all sides. */
  12.  
  13. pascal short CircularWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  14. {
  15.     RgnHandle    curregion;
  16.     short            cx,cy,lastx,lasty;
  17.     short            BlockSize;
  18.     
  19.     BlockSize=theWindowWidth/40;
  20.     cx = boundsRect.left + theWindowWidth / 2;
  21.     cy = boundsRect.top + theWindowHeight / 2;
  22.  
  23.     curregion=NewRgn();
  24.     lastx=boundsRect.left;
  25.     do                                            /* top quadrant */
  26.     {
  27.         StartTiming();
  28.         SetEmptyRgn(curregion);
  29.         MoveTo(cx,cy);
  30.         OpenRgn();
  31.             LineTo(lastx,boundsRect.top);
  32.             Line(BlockSize,0);
  33.             LineTo(cx,cy);
  34.         CloseRgn(curregion);
  35.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  36.             &boundsRect, &boundsRect, 0, curregion);
  37.         lastx+=BlockSize;
  38.         TimeCorrection(CorrectTime);
  39.     }
  40.     while (lastx<boundsRect.right);
  41.     
  42.     lasty=boundsRect.top;
  43.     do                                            /* right quadrant */
  44.     {
  45.         StartTiming();
  46.         SetEmptyRgn(curregion);
  47.         MoveTo(cx,cy);
  48.         OpenRgn();
  49.             LineTo(boundsRect.right,lasty);
  50.             Line(0,BlockSize);
  51.             LineTo(cx,cy);
  52.         CloseRgn(curregion);
  53.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  54.             &boundsRect, &boundsRect, 0, curregion);
  55.         lasty+=BlockSize;
  56.         TimeCorrection(CorrectTime);
  57.     }
  58.     while (lasty<boundsRect.bottom);
  59.     
  60.     lastx=boundsRect.right;
  61.     do                                            /* bottom quadrant */
  62.     {
  63.         StartTiming();
  64.         SetEmptyRgn(curregion);
  65.         MoveTo(cx,cy);
  66.         OpenRgn();
  67.             LineTo(lastx,boundsRect.bottom);
  68.             Line(-BlockSize, 0);
  69.             LineTo(cx,cy);
  70.         CloseRgn(curregion);
  71.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  72.             &boundsRect, &boundsRect, 0, curregion);
  73.         lastx-=BlockSize;
  74.         TimeCorrection(CorrectTime);
  75.     }
  76.     while (lastx>boundsRect.left-BlockSize);
  77.     
  78.     lasty=boundsRect.bottom;
  79.     do                                            /* left quadrant */
  80.     {
  81.         StartTiming();
  82.         SetEmptyRgn(curregion);
  83.         MoveTo(cx,cy);
  84.         OpenRgn();
  85.             LineTo(boundsRect.left,lasty);
  86.             Line(0, -BlockSize);
  87.             LineTo(cx,cy);
  88.         CloseRgn(curregion);
  89.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  90.             &boundsRect, &boundsRect, 0, curregion);
  91.         lasty-=BlockSize;
  92.         TimeCorrection(CorrectTime);
  93.     }
  94.     while (lasty>boundsRect.top-BlockSize);
  95.     
  96.     DisposeRgn(curregion);
  97.     
  98.     return 0;
  99. }
  100.